﻿using System;
using System.Collections;
using System.Text;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

namespace Common
{
    public static class PageOp
    {
        public delegate string GetValue(Control item);
        public static void SetRepeaterAttributes(IEnumerable repeaterObject, string controlID, string key, string value)
        {

            foreach (Control item in repeaterObject)
            {
                WebControl web = (WebControl)item.FindControl(controlID);
                if (web != null)
                {
                    web.Attributes.Add(key, value);
                }
            }
        }
        public static void SetRepeaterAttributes(IEnumerable repeaterObject, string controlID, string key, GetValue getValue)
        {

            foreach (Control item in repeaterObject)
            {
                string value = getValue(item);
                WebControl web = (WebControl)item.FindControl(controlID);
                if (web != null)
                {
                    web.Attributes.Add(key, value);
                }
            }
        }
    }
}
